package com.zwps.biz.domain.enums;

import com.zwps.biz.api.model.vo.mointordentify.MonitDentigyTypeVO;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

@Getter
@AllArgsConstructor
public enum InvasionTypeEnum {
    PERSONNEL_INTRUSION(1, "人员入侵"),
    FLOATING_OBJECT(2, "水面漂浮物"),
    SAND_DREDGING_SHIP(3, "非法采砂"),
    ENGINEERING_VEHICLE(4, "车辆入侵"),
    GARBAGE_DUMPING(5, "垃圾倾倒"),
    ILLEGAL_FISHING(6, "违法捕捞");
    private final int code;
    private final String description;


    public static InvasionTypeEnum fromName(String name) {

        switch (name) {
            case "人员入侵":
                return PERSONNEL_INTRUSION;
            case "水面漂浮物":
                return FLOATING_OBJECT;
            case "非法采砂":
                return SAND_DREDGING_SHIP;
            case "车辆入侵":
                return ENGINEERING_VEHICLE;
            case "垃圾倾倒":
                return GARBAGE_DUMPING;
            case "违法捕捞":
                return ILLEGAL_FISHING;
            default:
                throw new IllegalArgumentException("未知的入侵类型: " + name);
        }
    }


    public static List<MonitDentigyTypeVO> getAll() {
        List<MonitDentigyTypeVO> list = new ArrayList<>();
        for (InvasionTypeEnum value : InvasionTypeEnum.values()) {
            list.add(new MonitDentigyTypeVO(String.valueOf(value.getCode()), value.getDescription()));
        }
        return list;
    }
}
